﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ControllersAndActions.Controllers
{
    public class ExampleController : Controller
    {
        public ViewResult Index()
        {
            ViewBag.Message = TempData["Message"];
            ViewBag.Date = TempData["Date"];
            return View("Homepage");
            //return View("Index", "_AlternateLayoutPage");         //con otro layout
            //return View("~/Views/Other/Index.cshtml");        //otra vista (no olvidar la extensión, usar full path)
        }

        public RedirectToRouteResult Redirect()
        {
            TempData["Message"] = "Hello";
            TempData["Date"] = DateTime.Now;
            return RedirectToAction("Index");
        }
        public HttpStatusCodeResult StatusCode()
        {
            // return new HttpStatusCodeResult(404, "URL cannot be serviced");
            return HttpNotFound();
            //return new HttpUnauthorizedResult();
        }

    }
}
